<?php
session_start();
?>
<?php

require "lib/db.php";
require "lib/case-function.php";

if(isset($_POST['btnAddCase'])){
	$title = $_POST['txtTitle'];
	$description = $_POST['taDescription'];
	$caseMonth = $_POST['cbCaseMonth'];
	$caseYear = $_POST['cbCaseYear'];
	$customerID = $_POST['cbCustomer'];
	$priorityID = $_POST['cbPriority'];
	addCase($title,$description,$caseMonth,$caseYear,$customerID,$priorityID);
	header("location:list-case.php");
}

if(isset($_POST['btnEditCase'])){
	$caseID = $_POST['hfCaseID'];
	settype($caseID,"int");
	$title = $_POST['txtTitle'];
	$description = $_POST['taDescription'];
	$statusID = $_POST['cbStatus'];
	$solution = $_POST['taSolution'];
	editCase($title,$description,$statusID,$solution,$caseID);
	header("location:list-case.php");
}
?>